// Copyright 2018 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:m6/Public/manager/app_manager.dart';
// import 'package:flutter/services.dart';
import 'package:m6/business/login/login.dart';
// ignore: unused_import
import 'package:m6/business/tabbar/tabbar.dart';
import 'package:get/get.dart';

void main() {
  runApp(GetMaterialApp(
          initialBinding:
              AppGetBindings(), //BindingsBuilder(() => {Get.lazyPut(() => AppManager())})
          builder: EasyLoading.init(),
          theme: ThemeData(
              backgroundColor: Colors.red,
              brightness: Brightness.light, //控件颜色模式Light
              primaryColor: Colors.black),
          color: Colors.red,
          home: GetBuilder<AppManager>(
              id: "main_home_id",
              init: AppManager(),
              builder: (manager) =>
                  // ignore: unrelated_type_equality_checks
                  manager.isLogin.value == true
                      ? const Tabbar()
                      : const Login()))
      // home: FlutterEasyLoading(
      //   child: GetBuilder<AppManager>(
      //       // init: AppManager(),
      //       builder: (manager) =>
      //           // ignore: unrelated_type_equality_checks
      //           manager.isLogin.value == true ? const Tabbar() : const Login()),
      // )
      // )
      );
}

class AppGetBindings extends Bindings {
  @override
  void dependencies() {
    Get.lazyPut(() => AppManager());
  }
}



// class NavKey {
//   static final navKey = new GlobalKey<NavigatorState>();
// }
